﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.DC;
using DevExpress.Data.Filtering;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ConditionalAppearance;
using DomainComponents.XCRM;
using DomainComponents.Common;
using DevExpress.XtraCharts;

namespace XCRM.Module {
    [DomainComponent]
    [ImageName("BO_Scheduler")]
    public interface ICRMActivity : IActivity, INotes {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Contact")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Contact")]
    public interface ICRMContact : IContact, IGenericEmail, ILeadTarget, IQuoteCustomer, IOrderCustomer, IOpportunityCustomer, INotes, IAddressable, IActivityTarget, IPhones {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Customer")]
    [XafDisplayName("Account")]
    [NavigationItem(true, GroupName = "Sales")]
    public interface ICRMAccount : IAccount, IGenericEmail, ILeadTarget, IQuoteCustomer, IOrderCustomer, IOpportunityCustomer, INotes, IAddressable, IActivityTarget, IPhones {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Opportunity")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Opportunity")]
    public interface ICRMOpportunity : IOpportunity, ILeadTarget, IQuoteOpportunity, IOrderOpportunity, INotes, IGenericAddressableSale, IActivityTarget, ISaleStageHistoryTarget {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Order")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Order")]
    public interface ICRMOrder : IOrder, IGenericAddressableSale, ILeadTarget, INotes, IActivityTarget, ISaleStageHistoryTarget {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Quote")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Quote")]
    public interface ICRMQuote : IQuote, IGenericAddressableSale, ILeadTarget, INotes, IActivityTarget, ISaleStageHistoryTarget {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Sale")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Invoice")]
    public interface ICRMInvoice : IInvoice, IGenericAddressableSale, IOpportunityTarget, IOrderTarget, IOpportunityInvoice, INotes, IActivityTarget, ISaleStageHistoryTarget {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Lead")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Lead")]
    public interface ICRMLead : ILead, IGenericEmail, INotes, IPhones, IActivityTarget, IAddressable, ISaleStageHistory {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Product")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Product")]
    public interface ICRMProduct : IProduct, INotes {
    }    

    [DomainComponent]
    [VisibleInReports(false)]
    [XafDefaultProperty("DisplayName")]
    [ImageName("BO_User")]
    [XafDisplayName("User")]
    public interface IMyAppUser : IPersistentComplexSecurityUser, IPersistentAuthenticationStandardUser, IPerson { }

    [DomainLogic(typeof(IMyAppUser))]
    public class IMyAppUserLogic {
        public static string Get_DisplayName(IMyAppUser user) {
            return ((IPerson)user).FullName;
        }
    }
}
